package domain.items;

import java.util.Vector;

/**
 * thread = sequence of posts.
 * not to be confused with Topic (sequence of Topics\Threads)
 */
public class ForumThread extends Item{

	private Vector<Post> _posts;

/**
 * Constructor
 * @param father
 */
	public ForumThread(Item father){
		super(father);
		this._posts = new Vector<Post>();
		this._type = Item.FORUM_THREAD;
	}


/**
 * getters
 * @return
 */
	public Vector<Post> getPosts() {
		return _posts;
	}

/**
* getters
* @return
*/
	public void setPosts(Vector<Post> posts) {
		this._posts = posts;
	}

	public ThreadPacket convertToPacket(){
		ThreadPacket packet = new ThreadPacket();
		packet.setName(this.getName());
		for (Post post : this._posts) {
			packet.getPosts().add(post.convertToPacket());
		}
		return packet;
	}
}
